package com.itheima.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: bowen
 * @Date: 2019/7/20 19:43
 * @Description:
 */
@RestController
@RequestMapping("/hello")
public class HelloController {

	@RequestMapping("/add")
	@PreAuthorize("hasAuthority('add')")//表示用户必须拥有add权限才能调用当前方法
	public Object add() {

		System.out.println("add......");
	  return "add...";
	}

	@RequestMapping("/delete")
	@PreAuthorize("hasRole('ROLE_ADMIN')")//表示用户必须拥有add权限才能调用当前方法
	public Object delete() {

		System.out.println("delete......");
		return "delete...";
	}
}
